void setup(){  
  size(200, 200);
  background(255);    // Setting the background to white
  stroke(0);          // Setting the outline (stroke) to black
  line(0,0,100,100);
  stroke(255);
  noFill();         // Setting the interior of a shape (fill) to grey
  rect(50,50,75,100); // Drawing the rectangle
}
int blockNum = 5;
int operatorNum = 1;
void draw(){
  colorMode(RGB,100);
  int stepW = width/blockNum;
  stroke(255);
  for(int i=0;i<blockNum;i++){
    fill((i+1)*100/blockNum );
    stroke(100 - (i+1)*100/blockNum);
    rect(i*stepW,0,stepW,height); // Drawing the rectangle
  }
}
void mousePressed(){
  if( blockNum == 10 && operatorNum > 0){
    operatorNum = -operatorNum;
  }else if( blockNum == 5 && operatorNum < 0){
    operatorNum = -operatorNum;
  }
  blockNum += operatorNum;
}
